@use "../../assets/scss/mixins/figure/texture" as mx;
html {
  box-sizing: border-box;
  //根元素字体大小；10 / 16 = 62.5%，采用rem单位时，1rem = 10px
  font-size: 62.5%;
}
:root {
  --hue: 223;
  --bg: hsl(var(--hue), 10%, 70%);
  --fg: hsl(var(--hue), 10%, 10%);
  --focus: hsl(var(--hue), 90%, 60%);
  --focus-t: hsla(var(--hue), 90%, 60%, 0);
  --red-orange: hsl(11, 90%, 50%);
  --orange: hsl(21, 90%, 50%);
  --yellow-orange: hsl(31, 90%, 50%);
  --blue: hsl(198, 90%, 50%);
  --purple: hsl(287, 40%, 70%);
  --trans-dur: 0.3s;
  font-size: calc(20px + (80 - 20) * (100vw - 280px) / (3840 - 280));
}
* {
  margin: 0;
  padding: 0;
  box-sizing: inherit;
  &:before,
  &:after {
    box-sizing: inherit;
  }
}
body {
  height: 100vh;
  background-color: var(--bg);
  color: var(--fg);
  font: 1em/1.5 "Helvetica Neue", Helvetica, Arial, sans-serif;
  overflow: hidden;
  transition: background-color var(--trans-dur), color var(--trans-dur);
}
button {
  color: var(--fg);
  font: 1em/1.5 "Asap Condensed", sans-serif;
}
main {
  display: flex;
  overflow-x: hidden;
  padding: 1.5em 0;
  width: 100vw;
  height: 100vh;
}
.tb1 {
  --display-dim: 0.2;
  border-radius: 0.75em;
  box-shadow: 0.125em 0.125em 0.125em hsl(var(--hue), 10%, 90%) inset,
    -0.0625em -0.0625em 0.1875em hsl(var(--hue), 10%, 50%) inset,
    0 0 0.5em hsl(0, 0%, 0%, 0.5);
  margin: auto;
  padding: 1em;
  width: 14.25em;
  height: 15.75em;
  &,
  &__cell {
    background-color: hsl(var(--hue), 10%, 80%);
  }
  &__grid {
    background-color: hsl(var(--hue), 10%, 10%);
    border-radius: 0.25em;
    box-shadow: -0.0625em -0.0625em 0.0625em hsl(var(--hue), 10%, 90%),
      0.0625em 0.0625em 0.125em hsl(var(--hue), 10%, 50%);
    display: grid;
    gap: 0.25em;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: 1fr repeat(2, 3.75em);
    padding: 0.25em;
    width: 100%;
    height: 100%;
    transition: box-shadow var(--trans-dur);
  }
  &__bar {
    background-color: currentColor;
    height: 0.125rem;
    opacity: var(--display-dim);
    transition: opacity calc(var(--trans-dur) / 2);
    &--blue {
      background-color: var(--blue);
    }
    &--purple {
      background-color: var(--purple);
    }
    &--on {
      opacity: 1;
    }
    &--tall {
      height: 0.375em;
    }
    @for $i from 0 through 9 {
      $percent: 25 + $i * 5;
      &--#{25 + $i * 5}p {
        width: 0% + $percent;
      }
    }
  }
  &__bars {
    display: flex;
    gap: 0.125em;
    flex-direction: column-reverse;
    & + & {
      align-items: flex-end;
    }
  }
  &__button,
  &__dial {
    border-radius: 50%;
    margin: auto;
    width: 2.25em;
    height: 2.25em;
  }
  &__button,
  &__dial-control {
    display: flex;
  }
  &__button {
    box-shadow: 0.0625em 0 0.125em hsl(var(--hue), 10%, 70%) inset,
      -0.0625em 0 0.125em hsl(var(--hue), 10%, 90%) inset,
      0.0625em 0 0.125em hsl(var(--hue), 10%, 85%),
      -0.25em 0 0.375em hsla(0, 0%, 0%, 0.4);
    transition: all var(--trans-dur);
  }
  &__cell {
    border-radius: 0.25em;
    box-shadow: 0 0 0 0.125em var(--focus-t),
      0.0625em 0.0625em 0.0625em hsl(var(--hue), 10%, 90%) inset,
      -0.0625em -0.0625em 0.0625em hsl(var(--hue), 10%, 50%) inset;
    display: flex;
    transition: background-color var(--trans-dur), box-shadow var(--trans-dur),
      transform calc(var(--trans-dur) / 3) cubic-bezier(0.65, 0, 0.35, 1);
    &[type="button"] {
      cursor: pointer;
      &:active {
        transform: scale(0.95);
      }
      &:focus-visible {
        box-shadow: 0 0 0 0.125em var(--focus),
          0.0625em 0.0625em 0.0625em hsl(var(--hue), 10%, 90%) inset,
          -0.0625em -0.0625em 0.0625em hsl(var(--hue), 10%, 50%) inset;
      }
    }
    &--display {
      background-image: linear-gradient(
          80deg,
          hsl(var(--hue), 10%, 15%) 49%,
          hsla(var(--hue), 10%, 15%, 0) 50%
        ),
        linear-gradient(hsl(var(--hue), 10%, 25%), hsl(var(--hue), 10%, 30%));
      box-shadow: 0 0 0.125em hsl(var(--hue), 10%, 30%) inset !important;
      display: grid;
      grid-column: 3;
      grid-row-start: 2;
      grid-row-end: 4;
      grid-template-columns: repeat(2, 1fr);
      grid-template-rows: 0.75em 1fr;
      padding: 0.5em;
      text-transform: uppercase;
    }
    &--speakers {
      $holeDiameter: 0.625em;
      //   display: grid;
      //   grid-column-start: 1;
      //   grid-column-end: 4;
      //   grid-template-columns: repeat(15, $holeDiameter);
      //   grid-template-rows: repeat(7, $holeDiameter);
      //   align-content: center;
      //   justify-content: center;
      //   place-items: center;
      @include mx.hole {
        place-items: center;
        grid-column-start: 1;
        grid-column-end: 4;
      }
    }
  }
  &__dial {
    box-shadow: 0.0625em 0 0.125em hsl(var(--hue), 10%, 70%) inset,
      -0.0625em 0 0.125em hsl(var(--hue), 10%, 30%) inset,
      0.0625em 0 0.0125em hsl(var(--hue), 10%, 90%),
      -0.25em 0 0.375em hsla(0, 0%, 0%, 0.4);
    transition: background-color var(--trans-dur), box-shadow var(--trans-dur),
      color var(--trans-dur);
    &-control {
      --shadow-before-rotate: 0;
      --shadow-after1-x: 1;
      --shadow-after1-y: 1;
      --shadow-after2-x: -1;
      --shadow-after2-y: -1;
      background-color: transparent;
      border-radius: inherit;
      box-shadow: 0 0 0 0.125em var(--focus-t);
      cursor: grab;
      position: relative;
      transition: box-shadow var(--trans-dur);
      width: 100%;
      height: 100%;
      &:active {
        cursor: grabbing;
      }
      &:focus-visible {
        box-shadow: 0 0 0 0.125em var(--focus);
      }
      &::before,
      &::after {
        content: "";
        background: var(--blue);
        display: block;
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        z-index: 1;
      }
      &::before {
        border-radius: 50%;
        box-shadow: 0.0625em 0 0.0625em hsla(0, 0%, 0%, 0.3) inset,
          -0.0625em 0 0.0625em hsla(0, 0%, 100%, 0.3) inset;
        width: 1.75em;
        height: 1.75em;
        transform: translate(-50%, -50%)
          rotate(calc(1deg * var(--shadow-before-rotate)));
      }
      &::after {
        border-radius: 0.1875em;
        box-shadow: 2px 0 0 hsl(var(--hue), 10%, var(--shadow-after1-x)) inset,
          0 2px 0 hsl(var(--hue), 10%, var(--shadow-after1-y)) inset,
          -2px 0 0 hsl(var(--hue), 10%, var(--shadow-after2-x)) inset,
          0 -2px 0 hsl(var(--hue), 10%, var(--shadow-after2-y)) inset;
        opacity: 0.4;
        width: 0.375em;
        height: 1.25em;
      }
    }
  }
  &__cell[type="button"],
  &__dial-control {
    outline: 0;
    appearance: none;
    -webkit-tap-highlight-color: transparent;
  }
  &__display-label {
    display: block;
    font-size: 0.5em;
    line-height: 2;
    color: hsl(0, 0%, 100%);
  }
  &__icon {
    display: block;
    margin: auto;
    width: 1.5em;
    height: 1.5em;
  }
  &__rec {
    display: flex;
    align-items: center;
    gap: 0.375em;
    grid-column-start: 1;
    grid-column-end: 3;
    &-light {
      border-radius: 50%;
      box-shadow: 0 0 0 0.25em var(--orange) inset;
      display: block;
      opacity: var(--display-dim);
      width: 0.625rem;
      height: 0.625rem;
      transition: opacity calc(var(--trans-dur) / 2);
      &--on {
        opacity: 1;
      }
    }
  }
  //   &__speaker-hole {
  //     background-color: hsl(var(--hue), 10%, 10%);
  //     border-radius: 50%;
  //     width: 50%;
  //     height: 50%;
  //     box-shadow: 0 -0.0625em 0.0625em hsl(var(--hue), 10%, 70%),
  //       0 0.0625em 0.0625em hsl(var(--hue), 10%, 90%);
  //     transform: box-shadow var(--trans-dur);
  //     &:first-child,
  //     &:nth-child(83) {
  //       grid-column: 3;
  //     }
  //     &:nth-child(12),
  //     &:nth-child(70) {
  //       grid-column: 2;
  //     }
  //     &:nth-child(25) {
  //       grid-column: 1;
  //     }
  //   }
  &__sr-only {
    position: absolute;
    overflow: hidden;
    width: 1px;
    height: 1px;
  }
}
